<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match='nbsp' name='nbsp'>
<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>
</xsl:template>

<xsl:template match="activities">

<table class="body" border="0" cellspacing="0" cellpadding="0" width="100%">

<tr bgcolor="#EEEEEE">
<td>&#160;<b><xsl:value-of select="@place"/></b></td>
<xsl:for-each select="wday">
<td class="body_10px" align="center">
	<xsl:value-of select="@veryshortname"/><br/>
	<xsl:value-of select="@dayOfMonth"/>
</td>
</xsl:for-each>
</tr>

<xsl:for-each select="week">
<tr bgcolor="#FFFFFF">
	<td class="CDBf10" align="left">
	<a href="/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><xsl:value-of select="@title"/></a>
	</td>
	<xsl:variable name="activityId"><xsl:value-of select="@activityId"/></xsl:variable>
	<xsl:for-each select="/activities/wday">
	<xsl:variable name="dayOfYear"><xsl:value-of select="@dayOfYear"/></xsl:variable>
		<xsl:variable name="hits">
			<xsl:value-of select="/activities/weekDays[@day=$dayOfYear and @activityId=$activityId]/@hit"/>
			<xsl:for-each select="/activities/weekDays">
				<xsl:choose>
					<xsl:when test="@day=wday/@dayOfYear">
					<xsl:value-of select="@hit"/>
					</xsl:when>
					<xsl:otherwise>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:for-each>
		</xsl:variable>
		<td class="CDBf10c" align="center">
			<xsl:choose>
				<xsl:when test="$hits &gt; 0">
					<xsl:value-of select="$hits"/>
				</xsl:when>
				<xsl:otherwise>
					&#160;
				</xsl:otherwise>
			</xsl:choose>
		</td>
	</xsl:for-each>
</tr>
</xsl:for-each>
<tr bgcolor="#FFFFFF" height="10px">
	<td colspan="8" class="body" align="right">
	<a href="/allActivities.aspx?week=1" style="color:red;">...segue</a>
	</td>
</tr>

<xsl:for-each select="future">
<tr bgcolor="#FFFFFF">
	<td class="CDBf10" align="left">
	<a href="/activityShow.aspx?activityId={@activityId}" class="body_10px_red"><xsl:value-of select="@title"/></a>
	</td>
	<td colspan="5" align="center" class="CDBf10c">
		<font class="body_10px"><xsl:value-of select="@dd"/>/<xsl:value-of select="@mm"/>/<xsl:value-of select="@aaaa"/></font>
		</td>
	<td colspan="2" class="CDBf10c" align="center">
		<xsl:value-of select="@howMany"/>
	</td>
</tr>
</xsl:for-each>
<tr bgcolor="#FFFFFF">
	<td colspan="8" class="body" align="right">
	<a href="/allActivities.aspx?future=1" style="color:red;">...segue</a>
	</td>
</tr>
</table>

</xsl:template>

</xsl:stylesheet>